package com.bill.common.system.action;

import com.bill.common.system.dto.ExtractDTO;
import com.bill.common.system.service.IExtractService;
import com.opensymphony.xwork2.ActionSupport;
import com.sinba.common.dto.PageDTO;

import org.springframework.beans.factory.annotation.Autowired;

@SuppressWarnings( "serial" )
public class ExtractAction
    extends ActionSupport
{
    @Autowired
    private IExtractService extractService;
    private PageDTO pageDTO;
    private ExtractDTO extractDTO;
    private int page = 1;
    private int rows = 10;
    private String sidx;
    private String sord;
    private Long id;
    private String resultStr;
    private String pageUrl;

    public PageDTO getPageDTO(  )
    {
        return pageDTO;
    }

    public void setPageDTO( PageDTO pageDTO )
    {
        this.pageDTO = pageDTO;
    }

    public int getPage(  )
    {
        return page;
    }

    public void setPage( int page )
    {
        this.page = page;
    }

    public int getRows(  )
    {
        return rows;
    }

    public void setRows( int rows )
    {
        this.rows = rows;
    }

    public Long getId(  )
    {
        return id;
    }

    public void setId( Long id )
    {
        this.id = id;
    }

    public String getSidx(  )
    {
        return sidx;
    }

    public void setSidx( String sidx )
    {
        this.sidx = sidx;
    }

    public String getSord(  )
    {
        return sord;
    }

    public void setSord( String sord )
    {
        this.sord = sord;
    }

    //分页保存
    public ExtractDTO getExtractDTO(  )
    {
        return extractDTO;
    }

    public void setExtractDTO( ExtractDTO extractDTO )
    {
        this.extractDTO = extractDTO;
    }

    public String getResultStr(  )
    {
        return resultStr;
    }

    public void setResultStr( String resultStr )
    {
        this.resultStr = resultStr;
    }

    public IExtractService getExtractService(  )
    {
        return extractService;
    }

    public void setExtractService( IExtractService extractService )
    {
        this.extractService = extractService;
    }

    public String getPageUrl(  )
    {
        return pageUrl;
    }

    public void setPageUrl( String pageUrl )
    {
        this.pageUrl = pageUrl;
    }

    public String findPager(  )
    {
        int start = ( page - 1 ) * rows;
        pageDTO = extractService.findPager( extractDTO, start, rows, sord, sidx );
        pageDTO.setPage( page );
        pageDTO.setRows( rows );

        return SUCCESS;
    }
    ;

    //申请
    public String apply(  )
    {
        if ( ( pageUrl == null ) || ( pageUrl == "" ) )
        {
            pageUrl = "index.jsp";
        }

        resultStr = extractService.apply( extractDTO );

        return "optresult";
    }
    ;
    
    
    //申请
    public String subAccountApply(  )
    {
        if ( ( pageUrl == null ) || ( pageUrl == "" ) )
        {
            pageUrl = "index.jsp";
        }

        resultStr = extractService.subAccountApply( extractDTO );

        return "optresult";
    }
    ;

    //删除
    public String delete(  )
    {
        extractService.delete( id );

        return SUCCESS;
    }
    ;

    //确认受理
    public String confirm(  )
    {
        extractService.confirm( extractDTO );

        return SUCCESS;
    }
    ;
}
